#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <map>
#include <array>
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include "data.h"

using namespace std;

crouteplan::crouteplan(){

	m_route = new route();
}

crouteplan::~crouteplan(){

	delete(m_route);
}

void crouteplan::loadconfiguration(connection &conn, int len){

	path v_path(conn, len);
	m_route->insert(v_path);
}

int crouteplan::get_lenght(const connection & conn){

	int lenght = -1;
	route_iterator iterator;
	station st_temp;
	connection _conn = conn;
	if(_conn.source.id > _conn.destination.id)
	{
		st_temp = _conn.destination;
		_conn.destination = _conn.source;
		_conn.source = st_temp;
	}

	iterator = m_route->find(_conn);
	if(iterator != m_route->end()){
		
		lenght = iterator->second;
	}
	return(lenght);
}

int crouteplan::get_lenght(station & station_source, station & station_dest){

	connection conn(station_source, station_dest);
	return(get_lenght(conn));
}

void crouteplan::get_new_path(connection &){

}

void crouteplan::search_shortest_connection(){

}